package com.yantong.mapper;

import com.yantong.pojo.Product;
import com.yantong.pojo.ProductData;
import com.yantong.pojo.vo.ProductDataVo;
import com.yantong.pojo.vo.StaticVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface ProductDataMapper {
	List<ProductData> list(HashMap<String, Object> map, RowBounds rowBounds);
	List<ProductData> list(HashMap<String, Object> map);
	long count(HashMap<String, Object> map);

    long listBaseProductCount(HashMap<String, Object> map);
    List<ProductData> listBaseProduct(HashMap<String, Object> map, RowBounds rowBounds);
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_base
     *
     * @mbg.generated Sun Sep 09 08:58:04 CST 2018
     */
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_base
     *
     * @mbg.generated Sun Sep 09 08:58:04 CST 2018
     */
    int insert(Product record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_base
     *
     * @mbg.generated Sun Sep 09 08:58:04 CST 2018
     */
    int insertSelective(ProductData record);

    /**用
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_base
     *
     * @mbg.generated Sun Sep 09 08:58:04 CST 2018
     */
    ProductData selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_base
     *
     * @mbg.generated Sun Sep 09 08:58:04 CST 2018
     */
    int updateByPrimaryKeySelective(ProductData record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_base
     *
     * @mbg.generated Sun Sep 09 08:58:04 CST 2018
     */
    int updateByPrimaryKey(ProductData record);

    /**
     * 更新库存
     * @param total
     * @param pid
     * @param version
     * @return
     */
    int changeStock(@Param("nums") int total, @Param("pid") Long pid, @Param("version") Integer version);

    /**
     * 退回库存
     * @param total
     * @param pid
     * @param version
     * @return
     */
    int refundStock(@Param("nums") int total, @Param("pid") Long pid, @Param("version") Integer version);
    /**
     * 通过包含主键的Map更新平台商品库中表字段
     * 如需更新更新字段修改Mapper
     * @param updMap
     * @return
     */
	int changeBaseProductByIdMap(Map<Object, Object> updMap);

	/**
	 * 得到生活专区下面的商户商品
	 * @return
	 */
	List<ProductData> getProductBaseByCate();

	/**
	 * 导出功能数据列表
	 * @param map
	 * @param rowBounds
	 * @return
	 */
	List<ProductDataVo> getExprotProductlist(HashMap<String, Object> map);
	
	StaticVo sumcostprice(HashMap<String, Object> map);
	
	/**
	 * 得到Id 用
	 * @return
	 */
	Long getId();
	
	/**
	 * 得到商品
	 * @return
	 */
	ProductData getProduct(Long id);
	
	int updByProductId(ProductDataVo vo);

	int updByProductcId(ProductDataVo vo);
}